﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Molia.Premiere.Converter
{
    public class ForegroundConverter:MutilValueConverter
    {
        public override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            var r = (double) values[0];
            var g = (double) values[1];
            var b = (double) values[2];
            return new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb((byte) r, (byte) g, (byte) b));
        }
        public override object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            var color = (System.Windows.Media.SolidColorBrush) value;
            var arr = new object[3] { (double)color.Color.R, (double) color.Color.G, (double) color.Color.B};
            return arr;
        }
    }
}
